const observeAllResource = new PerformanceObserver((list) => {
    for (const item of list.getEntries()) {
        observeAllResource.disconnect()
        const json = item.toJSON()
        const reportData = {
            ...json,
            type: 'performance',
            subtype: json.entryType,
            resourceType: json.initiatorType,
            duration: json.duration,
            dns: json.domainLookupEnd - json.domainLookupStart,
            tcp: json.connectEnd - json.connectStart,
            redirect: json.redirectEnd - json.redirectStart,
            ttfb: json.responseStart,
            protocol: json.nextHopProtocol
        }

        console.log(reportData)
    }
})

observeAllResource.observe({ type: 'resource', buffered: true })
